<template>
  <div>
    <div v-if="selectModal">
      <CompetitionResult @updata="selectModal1"></CompetitionResult>
    </div>
    <div v-if="selectModal2">
      <LookCompetitionResult @updata="selectModa2"></LookCompetitionResult>
    </div>
    <div class="base-data">
      <header>
        <h3>办训办学评估
          <el-button type="success" size="small"><a download="2021评估申报表.doc" target="_blank"
              :href="downloadFile1">2023评估申报表下载</a></el-button>
        </h3>
      </header>
      <div style="background-color: #fff;padding: 10px;">
        <div style="padding: 0 15px;text-align: center;overflow: hidden;position:relative;">
          <el-button type="success" size="small" style="float: left;" @click="WatchHaveCulture">具有独立文化教育</el-button>
          <el-button type="success" size="small" style="float: left;" @click="WatchNOCulture">依附普通中小学进行文化教育</el-button>
          <el-button type="success" size="small" style="float: left;" @click="CompetitionResult">大赛成绩点击填报</el-button>
          <el-button type="success" size="small" style="float: left;" @click="LookCompetitionResult">大赛成绩查看</el-button>
          <div
            style="font-size:28px;color:#0da883;display: inline;position:absolute;top:50%;left: 50%;transform: translateX(-50%) translateY(-50%);"
            v-text="pageDatatableTitle"></div>
          <div style="float: right;position: relative;">
            <el-button type="success" size="small" @click="colIdAndChanges">保存</el-button>
            <el-button type="success" size="small" @click="printTable">打印</el-button>
            <el-button type="success" :loading="upLoading" size="small">申报表上传
              <input class="file" type="file" multiple @change="updateFace"
                style="width: 150px;transform: translateX(130px);" />
            </el-button>
            <div v-show="fileList.length!=0">
              <el-dropdown size="mini" style="font-size: 12px;margin-top: 10px;float: right;" @command="downloadFile">
                <el-button size="mini" type="primary">
                  申报表下载<i class="el-icon-arrow-down el-icon--right"></i>
                </el-button>
                <el-dropdown-menu slot="dropdown">
                  <el-dropdown-item size="mini" v-for="item,index in fileList" :command="item">{{item}}下载
                  </el-dropdown-item>
                </el-dropdown-menu>
              </el-dropdown>
            </div>
          </div>
        </div>


        <div class="table-box" style="padding: 10px;overflow: auto;max-height: 800px;">
          <table class="table">
            <thead>
              <tr>
                <td colspan="2">
                  名称
                </td>
                <td @click="ArrSort(this.app.ArrSort_flag)">学校自评（100分制）
                  <i :class='[this.ArrSort_flag ?"fa fa-sort-down" : "fa fa-sort-up"]' aria-hidden="true"></i>
                </td>
                <td>条目得分</td>
                <td>检查要求指示</td>
                <td>市局初审</td>
                <!-- <td>市局备注</td> -->
                <td>省局复核</td>
                <td>省局备注</td>
              </tr>
            </thead>
            <tbody v-show="a1.length ==0 ?false : true" style="display: none">
              <tr v-for="(item,index) in a1">
                <td> {{item.titleName}} </td>
                <td> {{item.subtitleName}}
                  <span @click="openNumTip" :hidden="item.titleName == '总分'? false:true">
                    <el-tooltip placement="top">
                      <div slot="content">
                        <h2>总分计算公式</h2>
                        <div style="font-size: 120%;" v-for="(item,index) in a1">
                          <div :hidden="item.titleName == '总分'? true:false">
                            <div v-if="item.selfAssessScore">{{item.titleName}} {{item.titleWeight}} <span>X</span>
                              {{item.subtitleName}} <span>X</span> {{item.selfAssessScore}} <span>=</span> <span
                                v-text="item.titleName == '总分'? getsecNumSum : getrealScore(index)"></span>
                            </div>
                          </div>
                        </div>
                        <div style="padding-left: 5px;">
                          <b style="color:red">*</b> <span>总分由上计算而出,详细标准请下载《评估标准》进行查看(页数:43)</span>
                        </div>
                      </div>
                      <i style="cursor: help;" class="el-icon-question"></i>
                    </el-tooltip>
                  </span>
                </td>
                <!--  <td :readonly="item.titleName == '总分'? 'false' : a1Num[index] = a1[index]" hidden="hidden"></td> -->
                <td>
                  <div style="text-align: center;">
                    <el-input size="small" v-if="item.titleName == '总分'"
                      style="width: 95%; height: 100%; display: block; border: none;" type="number" :disabled="true"
                      v-model="item.titleName == '总分'? getNumSum : a1[index].selfAssessScore"></el-input>
                  </div>
                  <div style="text-align: center;">
                    <el-input size="small" v-if="item.titleName == '基本条件'"
                      style="width: 95%; height: 100%; display: block; border: none;" type="number"
                      v-model="a1[index].selfAssessScore"></el-input>
                  </div>
                  <div style="text-align: center;">
                    <el-input size="small" v-if="item.titleName == '总分（基本条件）'"
                      style="width: 95%; height: 100%; display: block; border: none;" type="number" :disabled="true"
                      v-model="item.titleName == '总分（基本条件）'? getNumSum1 : a1[index].selfAssessScore"></el-input>
                  </div>
                  <div style="text-align: center;">
                    <el-input size="small" v-if="item.titleName == '科研医务'"
                      style="width: 95%; height: 100%; display: block; border: none;" type="number"
                      v-model="a1[index].selfAssessScore"></el-input>
                  </div>
                  <div style="text-align: center;">
                    <el-input size="small" v-if="item.titleName == '总分（科研医务）'"
                      style="width: 95%; height: 100%; display: block; border: none;" type="number" :disabled="true"
                      v-model="item.titleName == '总分（科研医务）'? getNumSum2 : a1[index].selfAssessScore"></el-input>
                  </div>

                  <div style="text-align: center;">
                    <el-input size="small" v-if="item.titleName == '训练过程'"
                      style="width: 95%; height: 100%; display: block; border: none;" type="number"
                      v-model="a1[index].selfAssessScore"></el-input>
                  </div>
                  <div style="text-align: center;">
                    <el-input size="small" v-if="item.titleName == '总分（训练过程）'"
                      style="width: 95%; height: 100%; display: block; border: none;" type="number" :disabled="true"
                      v-model="item.titleName == '总分（训练过程）'? getNumSum3 : a1[index].selfAssessScore"></el-input>
                  </div>
                  <div style="text-align: center;">
                    <el-input size="small" v-if="item.titleName == '教育教学'"
                      style="width: 95%; height: 100%; display: block; border: none;" type="number"
                      v-model="a1[index].selfAssessScore"></el-input>
                  </div>
                  <div style="text-align: center;">
                    <el-input size="small" v-if="item.titleName == '总分（教育教学）'" :disabled="true"
                      style="width: 95%; height: 100%; display: block; border: none;" type="number"
                      v-model="item.titleName == '总分（教育教学）'? getNumSum4 : a1[index].selfAssessScore"></el-input>
                  </div>
                  <div style="text-align: center;">
                    <el-input size="small" v-if="item.titleName == '人才质量'"
                      style="width: 95%; height: 100%; display: block; border: none;" type="number"
                      v-model="a1[index].selfAssessScore"></el-input>
                  </div>
                  <div style="text-align: center;">
                    <el-input size="small" v-if="item.titleName == '人才效益'"
                      style="width: 95%; height: 100%; display: block; border: none;" type="number"
                      v-model="a1[index].selfAssessScore"></el-input>
                  </div>
                  <div style="text-align: center;">
                    <el-input size="small" v-if="item.titleName == '人才效益追加'"
                      style="width: 95%; height: 100%; display: block; border: none;" type="number"
                      v-model="a1[index].selfAssessScore"></el-input>
                  </div>
                  <div style="text-align: center;">
                    <el-input size="small" v-if="item.titleName == '办训规模'"
                      style="width: 95%; height: 100%; display: block; border: none;" type="number"
                      v-model="a1[index].selfAssessScore"></el-input>
                  </div>

                </td>

                <!-- 条目得分 -->
                <td>
                  <div style="text-align: center;">
                    <el-input size="small" style="width: 100%; height: 100%; display: block; border: none;"
                      type="number" :disabled="true" v-if="item.titleName == '总分'"
                      v-model="item.titleName== '总分'? getsecNumSum : getrealScore(index)">
                    </el-input>
                  </div>
                  <div style="text-align: center;">
                    <el-input size="small" v-if="item.titleName == '基本条件'"
                      style="width: 95%; height: 100%; display: block; border: none;" type="number"
                      v-model="item.titleName== '基本条件'? getrealScore(index) : ''"></el-input>
                  </div>
                  <div style="text-align: center;">
                    <el-input size="small" v-if="item.titleName == '总分（基本条件）'"
                      style="width: 95%; height: 100%; display: block; border: none;" type="text" :disabled="true"
                      v-model="item.titleName== '总分（基本条件）'? getsecNumSum1 : getrealScore(index)"></el-input>
                  </div>

                  <div style="text-align: center;">
                    <el-input size="small" v-if="item.titleName == '科研医务'"
                      style="width: 95%; height: 100%; display: block; border: none;" type="number"
                      v-model="item.titleName== '科研医务'? getrealScore(index) : ''"></el-input>
                  </div>
                  <div style="text-align: center;">
                    <el-input size="small" v-if="item.titleName == '总分（科研医务）'"
                      style="width: 95%; height: 100%; display: block; border: none;" type="text" :disabled="true"
                      v-model="item.titleName== '总分（科研医务）'? getsecNumSum2 : getrealScore(index)"></el-input>
                  </div>

                  <div style="text-align: center;">
                    <el-input size="small" v-if="item.titleName == '训练过程'"
                      style="width: 95%; height: 100%; display: block; border: none;" type="number"
                      v-model="item.titleName== '训练过程'? getrealScore(index) : ''"></el-input>
                  </div>
                  <div style="text-align: center;">
                    <el-input size="small" v-if="item.titleName == '总分（训练过程）'"
                      style="width: 95%; height: 100%; display: block; border: none;" type="text" :disabled="true"
                      v-model="item.titleName== '总分（训练过程）'? getsecNumSum3 : getrealScore(index)"></el-input>
                  </div>
                  <div style="text-align: center;">
                    <el-input size="small" v-if="item.titleName == '教育教学'"
                      style="width: 95%; height: 100%; display: block; border: none;" type="number"
                      v-model="item.titleName== '教育教学'? getrealScore(index) : ''"></el-input>
                  </div>
                  <div style="text-align: center;">
                    <el-input size="small" v-if="item.titleName == '总分（教育教学）'"
                      style="width: 95%; height: 100%; display: block; border: none;" type="text" :disabled="true"
                      v-model="item.titleName== '总分（教育教学）'? getsecNumSum4 : getrealScore(index)"></el-input>
                  </div>

                  <div style="text-align: center;">
                    <el-input size="small" v-if="item.titleName == '人才质量'"
                      style="width: 95%; height: 100%; display: block; border: none;" type="number"
                      v-model="a1[index].selfAssessScore"></el-input>
                  </div>
                  <div style="text-align: center;">
                    <el-input size="small" v-if="item.titleName == '人才效益'"
                      style="width: 95%; height: 100%; display: block; border: none;" type="number"
                      v-model="a1[index].selfAssessScore"></el-input>
                  </div>
                  <div style="text-align: center;">
                    <el-input size="small" v-if="item.titleName == '人才效益追加'"
                      style="width: 95%; height: 100%; display: block; border: none;" type="number"
                      v-model="a1[index].selfAssessScore"></el-input>
                  </div>
                  <div style="text-align: center;">
                    <el-input size="small" v-if="item.titleName == '办训规模'"
                      style="width: 95%; height: 100%; display: block; border: none;" type="number"
                      v-model="a1[index].selfAssessScore"></el-input>
                  </div>
                </td>
                <td>
                  <div style="text-align: center;">
                    <el-input size="small" style="width: 95%; height: 100%; display: block; border: none;" type="text"
                      :title="a1[index].selfAssessMemo" v-model="a1[index].selfAssessMemo"></el-input>
                  </div>

                </td>
                <td> {{item.reAssessScore}} </td>
                <!-- <td>
                <div class="test_hidden"> {{item.reAssessMemo}}</div>
              </td> -->
                <td> {{item.finalAssessScore}} </td>
                <td>
                  <div class="test_hidden"> {{item.finalAssessMemo}}</div>
                </td>
              </tr>
            </tbody>
          </table>
        </div>
      </div>
      <div v-show="false" ref="baseDataPrint">
        <baseDataPrint />
      </div>
    </div>
  </div>

</template>

<script>
  import Decimal from "decimal.js"
  import LookCompetitionResult from '@/components/CompetitionResult/LookCompetitionResult.vue'
  import CompetitionResult from '@/components/CompetitionResult/CompetitionResult.vue'
  import baseDataPrint from '@/components/print/baseDataPrint.vue'
  import {
    save4org,
    CompetitionResultList,
    allData4org,
    base_fileUpload,
    listFiles,
    fileDownloadOSS
  } from '@/api/organization.js'

  export default {
    components: { baseDataPrint, CompetitionResult, LookCompetitionResult },
    data() {
      return {
        selectModal2: false,
        selectModal: false,
        a1: [], //获取的title、value
        ArrSort_flag: false, //标志
        ArrHaveCulture: [], //有教育教学的
        ArrNoCulture: [], //无教育教学
        //  a1Num :[], //所有数值  ---计算总分
        pageDatatableTitle: "具有独立文化教育", //表格有无文化成绩标识
        downloadFile1: 'http://39.108.61.54:9000/project_files/baseAssessEmptyFiles/2023评估申请表.doc',
        fileList: [],
        upLoading: false,
        dataList: [],
        defaultdataList: [],
        selectForm: {

        }
      }
    },
    created() {
      this.baseListFiles()
      // this.$message.error('数据暂时无法填入')
    },

    methods: {
      allData4org1() {
        let city1 = 0
        let city2 = 0
        let city3 = 0
        let city4 = 0
        let province1 = 0
        let province2 = 0
        let province3 = 0
        let province4 = 0
        let outcity1 = 0
        let outcity2 = 0
        let outcity3 = 0
        let outcity4 = 0
        let outprovince1 = 0
        let outprovince2 = 0
        let outprovince3 = 0
        let outprovince4 = 0
        allData4org({ "version": 2023 }).then(res => {

          if (res.data[0].reAssessMemo == "具有独立文化教育") {

            res.data.forEach((item) => {

              item["reAssessScore"] = item["reAssessScore"] ? item["reAssessScore"] : 0
              item["finalAssessScore"] = item["finalAssessScore"] ? item["finalAssessScore"] : 0


              if (item["titleName"] == "基本条件") {


                //市局 -------------总分
                city1 += Number(Decimal(item["reAssessScore"]).mul(Decimal(item["titleWeight"])).mul(
                  Decimal(item[
                    "subTitleWeight"])) * 1000)

                //省局--------------总分

                province1 += Number(Decimal(item["finalAssessScore"]).mul(Decimal(item["titleWeight"])).mul(
                  Decimal(item[
                    "subTitleWeight"])) * 1000)



              }
              if (item["titleName"] == "科研医务") {

                //市局 -------------总分
                city2 += Number(Decimal(item["reAssessScore"]).mul(Decimal(item["titleWeight"])).mul(
                  Decimal(item[
                    "subTitleWeight"])) * 1000)
                //省局--------------总分

                province2 += Number(Decimal(item["finalAssessScore"]).mul(Decimal(item["titleWeight"])).mul(
                  Decimal(item[
                    "subTitleWeight"])) * 1000)

              }
              if (item["titleName"] == "训练过程") {

                //市局 -------------总分
                city3 += Number(Decimal(item["reAssessScore"]).mul(Decimal(item["titleWeight"])).mul(
                  Decimal(item[
                    "subTitleWeight"])) * 1000)
                //省局--------------总分

                province3 += Number(Decimal(item["finalAssessScore"]).mul(Decimal(item["titleWeight"])).mul(
                  Decimal(item[
                    "subTitleWeight"])) * 1000)

              }
              if (item["titleName"] == "教育教学") {

                //市局 -------------总分
                city4 += Number(Decimal(item["reAssessScore"]).mul(Decimal(item["titleWeight"])).mul(
                  Decimal(item[
                    "subTitleWeight"])) * 1000)
                //省局--------------总分

                province4 += Number(Decimal(item["finalAssessScore"]).mul(Decimal(item["titleWeight"])).mul(
                  Decimal(item[
                    "subTitleWeight"])) * 1000)

              }

            })


            res.data[6].reAssessScore = city1 * 0.001
            res.data[6].finalAssessScore = province1 * 0.001

            //科研医务

            res.data[10].reAssessScore = city2 * 0.001
            res.data[10].finalAssessScore = province2 * 0.001
            //训练过程

            res.data[16].reAssessScore = city3 * 0.001
            res.data[16].finalAssessScore = province3 * 0.001
            //教育教学

            res.data[23].reAssessScore = city4 * 0.001
            res.data[23].finalAssessScore = province4 * 0.001

            this.a1 = res.data;

            console.log(this.a1);

            this.ArrHaveCulture = JSON.parse(JSON.stringify(this.a1))
            this.WatchHaveCulture()

          } else {
            res.data.forEach((item) => {
              item["reAssessScore"] = item["reAssessScore"] ? item["reAssessScore"] : 0

              item["finalAssessScore"] = item["finalAssessScore"] ? item["finalAssessScore"] : 0
              if (item["titleName"] == "基本条件") {





                //市局 -------------总分
                outcity1 += Number(Decimal(item["reAssessScore"]).mul(Decimal(item[
                  "titleWeightWithoutCulture"])).mul(
                  Decimal(item[
                    "subTitleWeightCulture"])) * 1000)

                //省局--------------总分

                outprovince1 += Number(Decimal(item["finalAssessScore"]).mul(Decimal(item[
                  "titleWeightWithoutCulture"])).mul(
                  Decimal(item[
                    "subTitleWeightCulture"])) * 1000)


              }
              if (item["titleName"] == "科研医务") {

                //市局 -------------总分
                outcity2 += Number(Decimal(item["reAssessScore"]).mul(Decimal(item[
                  "titleWeightWithoutCulture"])).mul(
                  Decimal(item[
                    "subTitleWeightCulture"])) * 1000)
                //省局--------------总分

                outprovince2 += Number(Decimal(item["finalAssessScore"]).mul(Decimal(item[
                  "titleWeightWithoutCulture"])).mul(
                  Decimal(item[
                    "subTitleWeightCulture"])) * 1000)

              }
              if (item["titleName"] == "训练过程") {

                //市局 -------------总分
                outcity3 += Number(Decimal(item["reAssessScore"]).mul(Decimal(item[
                  "titleWeightWithoutCulture"])).mul(
                  Decimal(item[
                    "subTitleWeightCulture"])) * 1000)
                //省局--------------总分

                outprovince3 += Number(Decimal(item["finalAssessScore"]).mul(Decimal(item[
                  "titleWeightWithoutCulture"])).mul(
                  Decimal(item[
                    "subTitleWeightCulture"])) * 1000)

              }
              if (item["titleName"] == "教育教学") {

                //市局 -------------总分
                outcity4 += Number(Decimal(item["reAssessScore"]).mul(Decimal(item[
                  "titleWeightWithoutCulture"])).mul(
                  Decimal(item[
                    "subTitleWeightCulture"])) * 1000)
                //省局--------------总分

                outprovince4 += Number(Decimal(item["finalAssessScore"]).mul(Decimal(item[
                  "titleWeightWithoutCulture"])).mul(
                  Decimal(item[
                    "subTitleWeightCulture"])) * 1000)

              }

            })

            res.data[6].reAssessScore = outcity1 * 0.001
            res.data[6].finalAssessScore = outprovince1 * 0.001

            //科研医务

            res.data[10].reAssessScore = outcity2 * 0.001
            res.data[10].finalAssessScore = outprovince2 * 0.001
            //训练过程

            res.data[16].reAssessScore = outcity3 * 0.001
            res.data[16].finalAssessScore = outprovince3 * 0.001
            //教育教学

            res.data[23].reAssessScore = outcity4 * 0.001
            res.data[23].finalAssessScore = outprovince4 * 0.001



            this.a1 = res.data;

            this.ArrHaveCulture = JSON.parse(JSON.stringify(this.a1))
            this.WatchNOCulture()
          }
        })
      },

      // //大赛成绩点击填报
      CompetitionResult() {
        this.selectModal = true
      },
      // //大赛成绩查看
      LookCompetitionResult() {
        this.selectModal2 = true
      },
      selectModa2() {
        this.selectModal2 = false
        this.allData4org1()

      },

      selectModal1() {
        this.selectModal = false

        this.allData4org1()
      },



      downloadFile(item) {
        // console.log(item, "99999999999999");
        let name = item.substring(0, item.lastIndexOf("."))
        let suffix = item.match(/\.([^\.]+)$/)[1];



        fileDownloadOSS(name, suffix).then(res => {
          try {
            var blob = res.data;
            // FileReader主要用于将文件内容读入内存
            var reader = new FileReader();
            reader.readAsDataURL(blob);
            // onload当读取操作成功完成时调用
            reader.onload = function(e) {
              var a = document.createElement('a');
              // 获取文件名fileName
              var fileName = res.headers["content-disposition"].split("=");
              fileName = fileName[fileName.length - 1];
              fileName = fileName.replace(/"/g, "");
              fileName = decodeURI(fileName)

              a.download = fileName;
              a.href = e.target.result;
              document.body.appendChild(a);
              a.click();
              document.body.removeChild(a);
            }
          } catch {
            this.$message.warning('没有找到文件！')
          }
        })
      },
      baseListFiles() {
        listFiles().then(res => {
          if (res.code === 200 && res.data.length != 0) {
            this.fileList = res.data
          } else {
            this.fileList = []
          }
        })
      },
      colIdAndChanges: function() {

        // this.$message({
        //   type: 'error',
        //   message: '已过申报时间'
        // })



        for (let i = 0; i < this.a1.length; i++) {
          if (this.pageDatatableTitle == "具有独立文化教育") {
            this.a1[i].reAssessMemo = "具有独立文化教育"
            if (this.a1[i].titleName == "人才效益") {
              this.a1[i].reAssessMemo = ""
            }
          } else {
            this.a1[i].reAssessMemo = "依附普通中小学进行文化教育"
            if (this.a1[i].titleName == "人才效益") {
              this.a1[i].reAssessMemo = ""
            }
          }
          this.a1[i].reAssessScore //删除复评
          // delete this.a1[i].finalAssessScore     //删除统评
          delete this.a1[i].createDateAuto //删除日期   若不删除 bad >request
        }
        // console.log(this.a1);
        if (this.a1[Object.keys(this.a1).length - 1].titleName == '总分') {
          this.a1[Object.keys(this.a1).length - 1].selfAssessScore = this.getNumSum


        }
        if (this.a1[Object.keys(this.a1).length - 23].titleName == '总分（基本条件）') {
          this.a1[Object.keys(this.a1).length - 23].selfAssessScore = this.getNumSum1
          console.log(this.getNumSum1, "this.getNumSum1");

        }
        if (this.a1[Object.keys(this.a1).length - 19].titleName == '总分（科研医务）') {
          this.a1[Object.keys(this.a1).length - 19].selfAssessScore = this.getNumSum2
          console.log(this.getNumSum2, "this.getNumSum2");
        }
        if (this.a1[Object.keys(this.a1).length - 13].titleName == '总分（训练过程）') {
          this.a1[Object.keys(this.a1).length - 13].selfAssessScore = this.getNumSum3
          console.log(this.getNumSum3, "this.getNumSum13");
        }
        if (this.a1[Object.keys(this.a1).length - 6].titleName == '总分（教育教学）') {
          this.a1[Object.keys(this.a1).length - 6].selfAssessScore = this.getNumSum4
          console.log(this.getNumSum4, "this.getNumSum4");
        }
        let parmas = this.a1
        // console.log(parmas, "9999999999999");


        save4org(parmas).then(res => {
          if (res.code === 200) {
            this.$message.success('数据保存成功！')
          }
        })
      },
      WatchHaveCulture() {
        this.pageDatatableTitle = "具有独立文化教育"
        this.a1 = this.ArrHaveCulture
        this.ArrHaveCulture.forEach((item) => {
          if (item.titleName == "基本条件") {
            item.titleWeight = "0.15"
          } else if (item.titleName == "科研医务") {
            item.titleWeight = "0.10"
          } else if (item.titleName == "训练过程") {
            item.titleWeight = "0.25"
          } else if (item.titleName == "教育教学") {
            item.titleWeight = "0.20"
          }
        })


      },
      WatchNOCulture() {
        this.pageDatatableTitle = "依附普通中小学进行文化教育"

        this.ArrHaveCulture.forEach((item) => {
          if (item.titleName == "基本条件") {
            item.titleWeight = "0.2"
          } else if (item.titleName == "科研医务") {
            item.titleWeight = "0.15"
          } else if (item.titleName == "训练过程") {
            item.titleWeight = "0.30"
          } else if (item.titleName == "教育教学") {
            item.titleWeight = "0"
          }
        })



        this.a1 = this.ArrHaveCulture
        // console.log(this.a1, '************');
      },
      printTable: function() {
        let ArrKey = JSON.stringify(this.a1)
        window.sessionStorage.setItem("ArrKey", ArrKey)
        const baseDataPrint = this.$refs.baseDataPrint
        this.$electronPrint(baseDataPrint.innerHTML, document.title, () => {
          this.$XPrint({
            sheetName: '打印',
            content: baseDataPrint.innerHTML
          })
        })
      },
      openNumTip: function() {
        $.magnificPopup.open({
          type: 'inline',
          preloader: false,
          focus: '#name',
          closeBtnInside: true,
          removalDelay: 100,
          mainClass: 'my-mfp-zoom-in',
          items: {
            src: '#docExcelFormModel'
          },
        });
      },
      ArrSort: function(ArrsortFlag) {
        function compare(property) {
          return function(a, b) {
            var value1 = a[property];
            var value2 = b[property];
            if (ArrsortFlag == true) {
              return value2 - value1; //倒序   value1-value2  正序
            } else {
              return value1 - value2;
            }
          }
        }
        this.a1 = this.a1.sort(compare('selfAssessScore'))
        this.ArrSort_flag = !ArrsortFlag
      },
      // ------------------上传--------------------------
      updateFace(e) {


        // this.$message({
        //   type: 'error',
        //   message: '已过申报时间'
        // })

        this.upLoading = true
        let file = e.target.files[0];
        let fileName = file.name
        let pathArr = fileName.split('\\')
        fileName = pathArr[pathArr.length - 1]
        fileName = encodeURI(fileName);
        if (file.size > 1024 * 1024 * 100) {
          this.$message({
            type: 'error',
            message: '文件太大，上传失败！'
          })
          this.upLoading = false
          return
        }
        let fileData = new FormData()
        fileData.append("fileName", fileName);
        fileData.append("file", file);
        base_fileUpload(fileData).then(res => {
          if (res.code === 200) {
            this.$message({
              type: 'success',
              message: '文件上传成功！'
            })
            this.baseListFiles()
            this.upLoading = false
          } else {
            this.$message({
              type: 'error',
              message: '文件上传失败！',
            })
            this.upLoading = false
          }
        })
      },
      // ------------------上传--------------------------
      getrealScore: function(index) {
        let a1 = this.a1
        let num = a1[index].selfAssessScore * a1[index].titleWeight * a1[index].subTitleWeight

        if (parseFloat(num)) {
          return parseFloat(num).toFixed(3);
        } else {
          return '';
        }
      },
    },


    mounted() {
      this.allData4org1()

    },
    computed: {
      a1Num: function() {
        return this.a1.filter(function(obj) { return obj.titleName !== '总分' })
      },
      //总分
      getNumSum: {
        //cache:false,
        get: function() {
          let getNumSum = 0;
          //cache:false
          // console.log(this.a1Num, "999999999999");
          for (let i = 0; i < this.a1Num.length; i++) {
            getNumSum = Number(this.a1Num[6].selfAssessScore) + Number(this.a1Num[10].selfAssessScore) + Number(this
                .a1Num[16].selfAssessScore) + Number(this.a1Num[23].selfAssessScore) + Number(this.a1Num[24]
                .selfAssessScore) + Number(this.a1Num[25].selfAssessScore) + Number(this.a1Num[26].selfAssessScore) +
              Number(this.a1Num[27].selfAssessScore)

          }

          if (parseFloat(getNumSum)) {
            return parseFloat(getNumSum)
          } else {
            return '';
          }

        }

      },
      getNumSum1: {
        //cache:false,
        get: function() {
          let getNumSum1 = 0;
          for (let i = 0; i < 6; i++) {
            getNumSum1 += Number(this.a1Num[i].selfAssessScore)
          }
          if (getNumSum1) {
            return getNumSum1
          } else {
            return '';
          }
        }
      },
      getNumSum2: {
        //cache:false,
        get: function() {
          let getNumSum2 = 0;
          for (let i = 7; i < 10; i++) {
            getNumSum2 += Number(this.a1Num[i].selfAssessScore)
          }
          // console.log(getNumSum2, "getNumSum2");
          if (getNumSum2) {
            return getNumSum2
          } else {
            return '';
          }
        }
      },
      getNumSum3: {
        //cache:false,
        get: function() {
          let getNumSum3 = 0;
          for (let i = 11; i < 16; i++) {
            getNumSum3 += Number(this.a1Num[i].selfAssessScore)
          }
          if (getNumSum3) {
            return getNumSum3
          } else {
            return '';
          }
        }
      },
      getNumSum4: {
        //cache:false,
        get: function() {
          let getNumSum4 = 0;
          for (let i = 17; i < 23; i++) {
            getNumSum4 += Number(this.a1Num[i].selfAssessScore)
          }
          if (getNumSum4) {
            return getNumSum4
          } else {
            return '';
          }
        }
      },
      getsecNumSum: {
        //cache:false,
        get: function() {
          let getNumSum = 0;
          //cache:false
          for (let i = 0; i < this.a1Num.length; i++) {
            getNumSum += (this.a1Num[i].selfAssessScore * this.a1Num[i].titleWeight * this.a1Num[i]
              .subTitleWeight) * 1000
          }
          // console.log(parseFloat(getNumSum))
          if (parseFloat(getNumSum)) {
            return getNumSum * 0.001;
          } else {
            return '';
          }

        }

      },
      getsecNumSum1: {
        //cache:false,
        get: function() {
          let getNumSum1 = 0;
          for (let i = 0; i < 6; i++) {
            getNumSum1 += (this.a1Num[i].selfAssessScore * this.a1Num[i].titleWeight * this.a1Num[i]
              .subTitleWeight) * 1000
          }
          if (getNumSum1) {
            console.log(getNumSum1);
            return getNumSum1 * 0.001

          } else {
            return '';
          }
        }
      },
      getsecNumSum2: {
        //cache:false,
        get: function() {
          let getNumSum2 = 0;
          for (let i = 7; i < 10; i++) {
            getNumSum2 += (this.a1Num[i].selfAssessScore * this.a1Num[i].titleWeight * this.a1Num[i]
              .subTitleWeight) * 1000
          }
          // console.log(getNumSum2, "getNumSum2");
          if (getNumSum2) {
            return getNumSum2 * 0.001
          } else {
            return '';
          }
        }
      },
      getsecNumSum3: {
        //cache:false,
        get: function() {
          let getNumSum3 = 0;
          for (let i = 11; i < 16; i++) {
            getNumSum3 += (this.a1Num[i].selfAssessScore * this.a1Num[i].titleWeight * this.a1Num[i]
              .subTitleWeight) * 1000
          }
          if (getNumSum3) {
            return getNumSum3 * 0.001
          } else {
            return '';
          }
        }
      },
      getsecNumSum4: {
        //cache:false,
        get: function() {
          let getNumSum4 = 0;
          for (let i = 17; i < 23; i++) {
            getNumSum4 += (this.a1Num[i].selfAssessScore * this.a1Num[i].titleWeight * this.a1Num[i]
              .subTitleWeight) * 1000
          }
          if (getNumSum4) {
            return getNumSum4 * 0.001
          } else {
            return '';
          }
        }
      },


    },
  }
</script>

<style lang="scss" scoped>
  .base-data {
    table tbody {

      display: block;

      height: calc(100vh - 333px);

      overflow-y: auto;

    }

    table thead,

    tbody tr {

      display: table;

      width: 100%;

      table-layout: fixed;

    }

    tbody::-webkit-scrollbar {
      /*滚动条整体样式*/
      width: 0px;
      /*高宽分别对应横竖滚动条的尺寸*/
      height: 0px;
      scrollbar-arrow-color: red;
    }

    tbody::-webkit-scrollbar-thumb {
      /*滚动条里面小方块*/
      border-radius: 5px;
      -webkit-box-shadow: inset 0 0 5px #2196f3;
      background: rgba(0, 0, 0, 0.2);
      scrollbar-arrow-color: red;
    }

    tbody::-webkit-scrollbar-track {
      /*滚动条里面轨道*/
      /* 滚动样式 有颜色*/
      /* -webkit-box-shadow: inset 0 0 5px rgba(0,0,0,0.2);              border-radius: 0;              background: rgba(0,0,0,0.1); */
      opacity: 0;
      /*完全透明*/
      border-radius: 2px;
    }





    .table {
      width: 100%;

      thead tr {
        border-bottom: 2px solid #ddd;
        font-weight: bold;
      }


    }



    .table td,
    .table th {
      border: 1px solid #ddd;
      color: #777;
      height: 40px;
      padding: 5px;

    }



    .table thead th {
      background-color: #ddd;
      width: 100px;
    }

    .table tr:nth-child(odd) {
      background: #f9f9f9;
    }

    .table tr:nth-child(even) {
      background: #ffffff;
    }

    .table tr:hover {
      background-color: #f2f9f9;
    }

    .file {
      width: 50px;
      height: 34px;
      opacity: 0;
      position: absolute;
      top: 0;
      left: 0;
    }

    .test_hidden {
      text-overflow: ellipsis;
      overflow: hidden;
      white-space: nowrap;
      width: 100px;
    }

    .meta-sort {
      display: flex;
      justify-content: center;
      align-items: center;
      margin: 20px 0;
    }



  }
</style>
